package com.ruoyi.modules.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.modules.domain.VehicleMonthAuditData;
import com.ruoyi.modules.mapper.VehicleMonthAuditDataMapper;
import com.ruoyi.modules.service.IVehicleMonthAuditDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.modules.mapper.VehicleCompanyCertificateMapper;
import com.ruoyi.modules.domain.VehicleCompanyCertificate;
import com.ruoyi.modules.service.IVehicleCompanyCertificateService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 车辆单车核准证Service业务层处理
 * 
 * @author ssh
 * @date 2024-12-15
 */
@Service
public class VehicleCompanyCertificateServiceImpl implements IVehicleCompanyCertificateService 
{
    @Autowired
    private VehicleCompanyCertificateMapper vehicleCompanyCertificateMapper;


    @Autowired
    private VehicleMonthAuditDataMapper vehicleMonthAuditDataMapper;

    /**
     * 查询车辆单车核准证
     * 
     * @param id 车辆单车核准证主键
     * @return 车辆单车核准证
     */
    @Override
    public VehicleCompanyCertificate selectVehicleCompanyCertificateById(String id)
    {
        return vehicleCompanyCertificateMapper.selectVehicleCompanyCertificateById(id);
    }

    /**
     * 查询车辆单车核准证列表
     * 
     * @param vehicleCompanyCertificate 车辆单车核准证
     * @return 车辆单车核准证
     */
    @Override
    public List<VehicleCompanyCertificate> selectVehicleCompanyCertificateList(VehicleCompanyCertificate vehicleCompanyCertificate)
    {
        return vehicleCompanyCertificateMapper.selectVehicleCompanyCertificateList(vehicleCompanyCertificate);
    }

    /**
     * 新增车辆单车核准证
     * 
     * @param vehicleCompanyCertificate 车辆单车核准证
     * @return 结果
     */
    @Override
    public int insertVehicleCompanyCertificate(VehicleCompanyCertificate vehicleCompanyCertificate)
    {
        vehicleCompanyCertificate.setCreateTime(DateUtils.getNowDate());
        return vehicleCompanyCertificateMapper.insertVehicleCompanyCertificate(vehicleCompanyCertificate);
    }

    /**
     * 修改车辆单车核准证
     * 
     * @param vehicleCompanyCertificate 车辆单车核准证
     * @return 结果
     */
    @Override
    public int updateVehicleCompanyCertificate(VehicleCompanyCertificate vehicleCompanyCertificate)
    {
        vehicleCompanyCertificate.setUpdateTime(DateUtils.getNowDate());
        return vehicleCompanyCertificateMapper.updateVehicleCompanyCertificate(vehicleCompanyCertificate);
    }

    /**
     * 批量删除车辆单车核准证
     * 
     * @param ids 需要删除的车辆单车核准证主键
     * @return 结果
     */
    @Override
    public int deleteVehicleCompanyCertificateByIds(String[] ids)
    {
        return vehicleCompanyCertificateMapper.deleteVehicleCompanyCertificateByIds(ids);
    }

    /**
     * 删除车辆单车核准证信息
     * 
     * @param id 车辆单车核准证主键
     * @return 结果
     */
    @Override
    public int deleteVehicleCompanyCertificateById(String id)
    {
        return vehicleCompanyCertificateMapper.deleteVehicleCompanyCertificateById(id);
    }

    /**
     *  单车核准审核--->审核
     */
    @Override
    @Transactional
    public int insertSingleCarApp(VehicleCompanyCertificate vehicleCompanyCertificate) {

        VehicleCompanyCertificate vehicleCompanyCertificat = new VehicleCompanyCertificate();
        // 视频审核数量
        String videoId = vehicleCompanyCertificate.getVechicle360VideoId();

        VehicleMonthAuditData vehicleMonthAuditData = vehicleMonthAuditDataMapper.selectVehicleMonthAuditDataById(Long.parseLong(videoId));
        if(null !=vehicleMonthAuditData){
//            vehicleCompanyCertificat.setCertUrl();
//            vehicleCompanyCertificat.setConstructionSiteId(vehicleMonthAuditData.getsConstructionSiteId());
        }

        return 0;
    }
}
